'use strict';

module.exports = app => {
  const { STRING, INTEGER, DATE, BOOLEAN } = app.Sequelize;

  const Banner = app.model.define('theme_banner', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    name: STRING(100),
    image: STRING(255),
    online: BOOLEAN,
    index: INTEGER,
    type: INTEGER,
    url: STRING(255),
    create_time: DATE,
    update_time: DATE,
    delete_time: DATE,
  }, {
    defaultScope: {
      attributes: {
        exclude: [ 'delete_time', 'update_time' ],
      },
    },
    timestamps: true,
    paranoid: true,
    createdAt: 'create_time',
    updatedAt: 'update_time',
    deletedAt: 'delete_time'
  });
  
  return Banner;
};
